/**
 * @param {number[]} reward1
 * @param {number[]} reward2
 * @param {number} k
 * @return {number}
 */
// 1 1 3 4 2 4 -3 -1 -1
var miceAndCheese = function (reward1, reward2, k) {
  let res=0,diff=[],len=reward1.length
  for(let i=0;i<len;i++){
    res+=reward2[i]
    diff[i]= reward1[i]-reward2[i]
  }

  diff.sort((a,b)=>a-b)
  for(let i=1;i<=k;i++){
    res+=diff[len-i]
  }

  return res
};